{% extends "main.html" %}

{% block content %}
<div class="content-box">
  <div class="content-box-header">
    <h3>Profits</h3>
    <ul class="content-box-tabs">
      <li><a href="#tab1" class="default-tab">List</a></li>
      {% if user.is_staff %}
        <li><a href="/receitas/novo">Add Profit</a></li>
      {% endif %}
    </ul>
    <div class="clear"></div>
</div>

<div class="content-box-content">
  <div class="tab-content default-tab" id="tab1">
      
      <table>
        <thead>
          <tr>
          
            <th>Receipt Number</th>
            <th>Profit</th>
            <th>Fraction</th>
            <th style="width:100px">Value</th>
            <th>Payment Sate</th>
            <th>Emission Date</th>
	    <th>Payment Date</th>
            <th>Details</th>
            <th></th>
          </tr>
        </thead>
	{% for receita in object_list %}
	  
	<tr> 
	  <td>{{receita.nrFactura}}</td>
	  <td>{{receita.get_receita_display }} </td>
	  <td>{{receita.fraccao}}</td>
	  <td>{{receita.valor}} €</td>
	  <td>{{receita.get_situacao_display}}</td>
	  <td>{{receita.dataEmissao}}</td>
	  <td>{{receita.dataPagamento}}</td>
      <td>{{receita.obs}}</td>
	    <td>{% if user.is_staff %}<a href="{% url editar_receita object_id=receita.pk %}">Editar</a> | <a href="{% url apagar_receita object_id=receita.pk %}">Apagar</a>{% endif %}</td>
        </tr> 
	{% endfor %}
      </table>
      <p></p>
     <div class="notification success png_bg">
        <div>Total profits received: {{valorTotalReceitas}} €</div>
      </div>
<div class="notification error png_bg">
        <div>Total profits not received: {{valorTotalPorReceber}} €</div>
      </div>
<div class="notification information png_bg">
        <div>Total profits for the actual exercise: {{valorTotalExercicio}} €</div>
      </div>
      <div class="notification information png_bg">
        <div>Number of total profits: {{nrTotalReceitas}}</div>
      </div>
    </div>
  </div>
</div>
{% endblock %}
